package com.opages.cloud.example.controller;

import com.opages.cloud.example.api.CloudExampleApi;
import com.opages.cloud.example.model.CloudExampleDto;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author daizhong.liu
 * @create 2020-06-07 20:06
 **/
@RestController
public class CloudExampleController implements CloudExampleApi {
    @Override
    public List<CloudExampleDto> examples(String name) {
        List<CloudExampleDto> examples = new ArrayList<>();
        for(int i=0;i<5;i++) {
            CloudExampleDto ce = new CloudExampleDto();
            ce.setExampleName("name"+i);
            ce.setExampleType(1);
            examples.add(ce);
        }
        return examples;
    }

    @Override
    public void save(CloudExampleDto example) {
        System.err.println(example.toString());
    }
}
